def T2rgb(Ts, fn='smj10q.csv', n=None, modw=None):
...
def Temp_to_rgb(temps, eye_response_fn='smj10q.csv', normed_at=None, modulate_with=None):
"""
Converts an array of blackbody temperatures to RGB.
Parameters
----------
temps: numpy array
The temperatures to convert
eye_response_fn : str
Path to the file with the human eye cone response functions
normed_at: float or None
The temperature at which the responses should be unity, or None to
apply no rescaling of the response functions.
modulate_with: numpy array or None
A rescaling factor to multiply the output cones by, or None to do no
rescaling of the output.
Returns
-------
rgb : numpy array
The output RGB values. Has shape (3, ... shape of ``temps`` ...)
"""
...
def square(val):
return 4*val
def square(val):
"""
The perimeter of a square with size ``val``.
"""
return 4*val
def square(val):
"""
The perimeter of a square with size ``val``.
"""
return 4*val
# In the notebook this will pop up a window with the docstring
square?
print(square.__doc__)
The perimeter of a square with size ``val``.
Which allows all kinds of magic.
Use them in every function you write, and put them at the top of a .py file, giving things like:
import astropy
print(astropy.__doc__)
Astropy is a package intended to contain core functionality and some common tools needed for performing astronomy and astrophysics research with Python. It also provides an index for other astronomy packages and tools for managing them.
See example at http://docs.astropy.org/en/stable/nddata/index.html
Actually developed before Sphinx narrowly focused on Python docs
A good primer: http://www.sphinx-doc.org/en/1.5/rest.html
from IPython.core.display import display, Markdown
with open('rest_example.rst') as f:
display(Markdown('```\n'+f.read()+'\n```'))
This is a paragraph. It's quite
short.
This paragraph will result in an indented block of
text, typically used for quoting other text.
1. This is a numbered item
2. As is this
This is inline code: ``np.random.randn(100)``
And this is a block of code::
a = np.random.randn(100)
plt.plot(a)
And here's a nice image:
.. image:: astropylogo.png
from IPython.core.display import display, HTML
with open('rest_example.html') as f:
display(HTML(f.read()))
This is a paragraph. It's quite short.
This paragraph will result in an indented block of text, typically used for quoting other text.
This is inline code: np.random.randn(100)
And this is a block of code:
a = np.random.randn(100) plt.plot(a)
And here's a nice image:
python setup.py build_docs
.. automodapi:: yourpkg
"